#include <stdio.h>

int main(void)
{
    int guess = 1;

    printf("Pick an interger  from 1 to 100. I will try to guess it\n");
    printf("Respond with a y if my guess is right and with an n if it is wrong.\n");
    printf("Un...is your number %d?\n", guess);

    char respond;

    while ((respond = getchar()) != 'y')
    {
        if (respond == 'n')
            printf("Well, then is it %d\n", ++guess);
        else
            printf("Sorry, I understand only y or n.\n");
        while (getchar() != '\n')
            continue;
    }
    printf("I knew I could do it.\n");

    return 0;
}